<!--课程考核成绩审核-->
<template>
  <div class="wrapper-container">
    <div class="search-container">
      <InputItem
        :name="'课程编号'"
        :value="itemType"
        @input="
          (e) => {
            itemType = e;
          }
        "
      ></InputItem>
      <InputItem
        :name="'课程名称'"
        :value="coursename"
        @input="
          (e) => {
            coursename = e;
          }
        "
      ></InputItem>

      <div class="search-button" style="margin-right: 25px" @click="queryscore">
        <img src="../../../assets/assessment/icon-search.png" alt="" />
        <span>查询</span>
      </div>
    </div>
    <div class="table-container">
      <el-table
        :data="tableData"
        border
        style="width: 100%"
        class="table-data"
        row-class-name="row-class"
        cell-class-name="cell-class"
        header-row-class-name="header-row-class"
        header-cell-class-name="header-cell-class"
      >
        <el-table-column
          width="70"
          align="center"
          type="selection"
          label="选择"
        >
        </el-table-column>
        <el-table-column prop="termid" label="课程编号" align="center">
        </el-table-column>
        <el-table-column prop="designcontent" label="课程名称" align="center">
        </el-table-column>
        <el-table-column
          width="200"
          prop="coursename"
          label="简称"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="professionaldivisions"
          label="学分"
          align="center"
        >
        </el-table-column>
        <el-table-column prop="teachingfaculty" label="总学分" align="center">
        </el-table-column>
        <el-table-column
          prop="shouldrecord"
          label="适用培养层次"
          align="center"
        >
        </el-table-column>
        <el-table-column prop="shouldrecord" label="是否主干课" align="center">
        </el-table-column>
        <el-table-column prop="shouldrecord" label="备注" align="center">
        </el-table-column>
      </el-table>
    </div>

    <div class="bottom-block">
      <div class="export-button">
        <img src="../../../assets/assessment/icon-export.png" alt="" />
        <download-excel
          class="export-btn"
          :data="tableData"
          :fields="jsonFields"
          type="xls"
          name="填报课程考试计划.xls"
          style="color: #f3b815"
        >
          &ensp;导出Excel
        </download-excel>
      </div>
    </div>
    <div class="button-group">
      <div class="" @click="getsubmit('保存')">保 存</div>
      <div class="" @click="getsubmit('取消')">取 消</div>
    </div>
    <el-dialog
      title="选择其他可开课学期"
      :visible.sync="showManualEntryDialog"
      width="50%"
      class="manual-entry-container"
    >
      <el-table
        :data="tableData"
        border
        style="width: 100%"
        class="table-data"
        row-class-name="row-class"
        cell-class-name="cell-class"
        header-row-class-name="header-row-class"
        header-cell-class-name="header-cell-class"
      >
        <el-table-column prop="name" label="学年" align="center">
          <template>
            <el-checkbox v-model="checkeds">第一学年</el-checkbox>
          </template>
        </el-table-column>
        <el-table-column prop="simpleName" label="学期" align="center">
          <el-checkbox-group
            v-model="checkedCities"
            @change="handleCheckedCitiesChange"
          >
            <el-checkbox
              v-for="city in cities"
              :label="city"
              :key="city"
              style="display: block"
              >{{ city }}</el-checkbox
            >
          </el-checkbox-group>
        </el-table-column>
      </el-table>
      <div style="width:200px;display:flex;border:none">
      <button
        @click="pjByIdGuidesave"
        style="
          width: 90px;
          height: 30px;
          border: 1px solid #f3b815;
          border-radius: 6px;
          color: #f3b815;
          margin-top: 20px;
        "
      >
        保存
      </button>
      <button
        @click="pjByIdGuidesave"
        style="
          width: 90px;
          height: 30px;
          border: 1px solid #FF3819;
          border-radius: 6px;
          color: #FF3819;
          margin-top: 20px;
          margin-left:30px
        "
      >
        取消
      </button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import SelectItem from "../../../components/SelectItem.vue";
import InputItem from "../../../components/InputItem.vue";
import ButtonItem from "../../../components/ButtonItem.vue";
import Subscript from "../../../components/Subscript.vue";
import { queryscore } from "@/api/admin1/check";
const cityOptions = ["夏季学期", "秋季学期", "春季学期"];
export default {
  components: {
    SelectItem,
    InputItem,
    ButtonItem,
    Subscript,
  },
  data() {
    return {
      checkeds: "",
      checkAll: false,
      checkedCities: ["上海", "北京"],
      cities: cityOptions,
      isIndeterminate: true,
      showManualEntryDialog: "true",
      checked: false,
      itemType: "",
      traininglevel: "",
      coursename: "",
      tableData: [
        {
          termid: "2020春",
          researchOffice: "专业班次一二三",
          coursename: "061029（博士课）【话语分析专题研究】",
          professionaldivisions: "",
          teachingfaculty: "李教员",

          checkusualscore: "", //课下
          checkexperimentscore: "", //课堂
          checkmidtermscore: "", //期中
          issue: "", //课终

          number: "10",
          value11: "0",
          value12: "80",
          value13: "80",
          value21: "0",
          value22: "80",
          value23: "80",
          grade: "专业班次一二三",
          clasename: "1",
          cultivationLevel: "专业班次一二三",
          practiceType: "必修",
          courseName: "课程名称1",
        },
        {
          xq: "2020春",
          researchOffice: "专业班次一二三",
          coursenumCoursename: "061029（英语课）【专题研究】",
          teachingfaculty: "李教员",
          number: "90",
          value11: "0",
          value12: "80",
          value13: "20",
          value21: "0",
          value22: "80",
          value23: "80",
          value31: "0",
          value32: "80",
          value33: "80",
          value4: "/",
          grade: "专业班次一二三",
          clasename: "1",
          cultivationLevel: "专业班次一二三",
          practiceType: "必修",
          courseName: "课程名称1",
        },
        {
          xq: "2020春",
          researchOffice: "专业班次一二三",
          coursenumCoursename: "061029（博士课）【话语分析专题研究】",
          teacherName: "李教员",
          number: "80",
          grade: "专业班次一二三",
          clasename: "1",
          cultivationLevel: "专业班次一二三",
          practiceType: "必修",
          courseName: "课程名称1",
        },
      ],
      multipleSelection: [],
    };
  },
  mounted() {
    this.queryscore();
  },
  methods: {
    //  按条件查询
    queryscore() {
      let obj = {
        termid: this.termid,
        designcontent: this.designcontent,
        traininglevel: this.traininglevel,
        studytype: this.studytype,
        teachingfaculty: this.teachingfaculty,
        coursename: this.coursename,
      };
      return new Promise(() => {
        queryscore(obj).then((res) => {
          if (res.data.code == 200) {
            this.tableData = res.data.data;
            let data = res.data.data;
            let obj = new Object();
            for (const dataKey in data) {
              let ktworkList = data[dataKey].ktwork.split("/");
              for (const ktworkListKey in ktworkList) {
                obj["value1" + (parseInt(ktworkListKey) + 1)] =
                  ktworkList[ktworkListKey];
              }
              let ktreviewList = data[dataKey].ktreview.split("/");
              for (const ktreviewListKey in ktreviewList) {
                obj["value2" + (parseInt(ktreviewListKey) + 1)] =
                  ktreviewList[ktreviewListKey];
              }
              let qzreviewList = data[dataKey].qzreview.split("/");
              for (const qzreviewListKey in qzreviewList) {
                obj["value3" + (parseInt(qzreviewListKey) + 1)] =
                  qzreviewList[qzreviewListKey];
              }
              let kzreviewList = data[dataKey].qzreview.split("/");
              for (const kzreviewListKey in kzreviewList) {
                obj["value4" + (parseInt(kzreviewListKey) + 1)] =
                  kzreviewList[kzreviewListKey];
              }
              this.tableData[dataKey] = { ...obj, ...this.tableData[dataKey] };
            }
          }
        });
      });
    },
    handleCheckAllChange(val) {
      this.checkedCities = val ? cityOptions : [];
      this.isIndeterminate = false;
    },
    handleCheckedCitiesChange(value) {
      let checkedCount = value.length;
      this.checkAll = checkedCount === this.cities.length;
      this.isIndeterminate =
        checkedCount > 0 && checkedCount < this.cities.length;
    },
  },
  computed: {},
};
</script>
<style lang="less" scoped>
.search-container {
  justify-content: flex-start !important;
}
.export-button {
  background: #fff6ef;
  border: 1px solid #f3b815;
  width: auto;
  height: 28px;
  line-height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  box-sizing: border-box;
  > span {
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #f3b815;
  }
  > img {
    width: 16px;
    height: 16px;
    margin-right: 5px;
  }
}
.search-button {
  cursor: pointer;
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  width: 70px;
  height: 27px;
  background: #f1f8fe;
  border: 1px solid #51aef6;
  border-radius: 6px;

  > span {
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #51aef6;
  }

  > img {
    width: 19px;
    height: 19px;
    margin-right: 4px;
  }
}

.table-container {
  margin-top: 30px;

  .el-table td,
  .el-table th.is-leaf,
  .el-table--border,
  .el-table--group {
    border-color: #c7d7eb;
  }

  .el-table__header tr,
  .el-table__header th {
    padding: 0;
    height: 76px;
    background-color: #edf2f9;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    line-height: 20px;
    color: #004ca7;
  }

  .el-table__body tr,
  .el-table__body td {
    padding: 0;
    height: 86px;
  }

  .wrapper-button {
    display: flex;
    flex-direction: column;
    align-items: center;

    > div {
      margin-bottom: 8px;
    }
  }
}
</style>

<style lang="less" scoped>
@import "../../../styles/special.less";

.bottom-block {
  display: flex;
  flex-direction: row;
  //   justify-content: flex-end;
  margin-top: 20px;

  .text {
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    line-height: 39px;
    color: #004ca7;
  }
}

.table-container5 {
  display: flex;

  .table-data:first-child {
    border-right: none !important;
    border-radius: 9px 0px 0px 9px;
  }

  .table-data:last-child {
    border-radius: 0px 9px 9px 0px;
    border-left: 1px solid #c7d7eb !important;
  }

  .table-data:not(:first-child):not(:last-child) {
    border-right: none !important;
    border-left: 0.8px solid #c7d7eb !important;
    border-radius: 0px !important;
  }

  .table-data {
    min-height: 500px;
  }
}

.table-container ::v-deep .el-table--border .el-table__cell:first-child .cell {
  padding-left: 10px !important;
}

.filter-button1::v-deep .el-radio-button .el-radio-button__inner {
  border-radius: 6px !important;
  border: 1px solid rgb(245, 134, 106);
  color: rgb(245, 134, 106);
  background-color: rgb(254, 237, 226);
}

.filter-button1::v-deep
  .el-radio-button__orig-radio:checked
  + .el-radio-button__inner {
  border: 1px solid rgb(245, 134, 106);
  color: white;
  background-color: rgb(245, 134, 106);
}

.filter-button {
  display: flex;
  margin-top: 27px;
}

.wrapper-container {
  width: 1711px;
  margin: 0 auto;
}

.table-container2 {
  .table-data {
    min-height: 500px;
  }

  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-container {
  margin-top: 30px;

  .table-data {
    width: 100%;
    border: 0.8px solid #004ca7;
    border-radius: 9px;
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #004ca7;
  }
}

.save-button {
  width: 87px;
  height: 36px;
  line-height: 36px;
  background: #fff6ef;
  border: 1px solid #f3b815;
  border-radius: 6px;
  font-size: 18px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: #f3b815;
  text-align: center;
  margin: 82px auto;
}

.zuoyou {
  width: 200px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}
.button-group {
  margin-top: 50px;
  text-align: center;

  > div {
    display: inline-block;
    font-size: 18px;
    padding: 6px 22px;
    border-radius: 6px;

    &:nth-child(1) {
      color: #f3b815;
      border: 1px solid #f3b815;
      background: #fff6ef;
      margin-right: 139px;
    }

    &:nth-child(2) {
      color: #ff3819;
      border: 1px solid #ff3819;
      background: #ffefef;
    }
  }
}
.manual-entry-container {
  .el-dialog__body {
    height: 200px;
    > div {
      width: 1014px;
      border: 1px solid rgba(0, 76, 167, 0.8);
      border-radius: 6px;
      margin: 0 auto;
      > div {
        border-bottom: 1px solid rgba(0, 76, 167, 0.39);
        &:last-child {
          border-bottom: none;
        }
        > div {
          display: flex;
          > div {
            height: 96px;
            display: flex;
            align-items: center;
            justify-content: center;
            &:nth-child(1) {
              width: 420px;
              text-align: center;
              font-size: 16px;
              font-weight: bold;
              color: #004ca7;
              background: rgba(77, 129, 192, 0.1);
            }
            &:nth-child(2) {
              padding-left: 19px;
            }
          }
        }
      }
    }
  }

  .el-dialog__footer {
    padding-bottom: 43px;
  }

  .dialog-footer {
    > button {
      width: 90px;
      height: 36px;
      background: #fff6ef;
      border: 1px solid #f3b815;
      border-radius: 6px;
      background: rgba(255, 246, 239, 1);
      font-size: 18px;
      color: #f3b815;
    }
  }
}
.el-checkbox:last-of-type {
  margin-right: 30px !important;
}
</style>
